import java.util.Scanner;

public class Demo01 {

	public static void main(String[] args) {
		
		Scanner demo = new Scanner (System.in);
		
		int a [] = new int [6] ;
		
		for (int i = 0; i < 6; i++) {
			System.out.println("");
			a[i] = demo.nextInt();
		}
		
		int MAX = a[0];
		int MIN = a[0];
		
		for (int i = 0; i < a.length; i++) {
			if (MAX < a[i]) {
				MAX = a[i];
			}
		}
		for (int i = 0; i < a.length; i++) {
			if (MIN > a[i]) {
				MIN = a[i];
			}
		}
		
		int SUM = 0;
		
		for (int i = 0; i < a.length; i++) {
			SUM = SUM + a[i];
		}
		
		int AVG = SUM - MAX - MIN;
		
		System.out.println(AVG / 4);
		
	}

}
